//
//  PayHelpVC.m
//  ImGuider
//
//  Created by 李陆涛 on 2017/10/25.
//  Copyright © 2017年 AudioCtrip. All rights reserved.
//

#import "PayHelpVC.h"
#import <WebKit/WebKit.h>

@interface PayHelpVC ()<WKUIDelegate, WKNavigationDelegate>

@property (nonatomic, strong) WKWebView *webView;
@property (nonatomic) NSInteger res;

@end

@implementation PayHelpVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setup];
}

- (void)setup {
    
    self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT - kNavigationBarHeight) configuration:[WKWebViewConfiguration new]];
    self.webView.UIDelegate = self;
    self.webView.navigationDelegate = self;
    [self.view addSubview:self.webView];
    
    [ActivityIndicatorView showHUDAddedTo:self.view backgroundColor:kBGColor];
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
}
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation {
    
    // 禁用选中效果
    [self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none'" completionHandler:nil];
    [self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none'" completionHandler:nil];
}

- (void)webView:(WKWebView *)webView didCommitNavigation:(null_unspecified WKNavigation *)navigation {
    
    
    [ActivityIndicatorView hideHUDAddedTo:self.view];
}

- (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
    
    [ActivityIndicatorView hideHUDAddedTo:self.view];
}

@end
